/*
 * Exception.h
 *
 *  Created on: 26/11/2011
 *      Author: godinho
 */

#ifndef EXCEPTION_H_
#define EXCEPTION_H_

#include <exception>
#include <stdarg.h>
#include <stdio.h>
#include <string>

using namespace std;

namespace rsi {

class Exception : public exception {
public:
	Exception(std::string fmt, ...) {
		mMessage = new char[100];

		va_list argp;
		va_start(argp, fmt);
		vsprintf(mMessage, fmt.c_str(), argp);
		va_end(argp);
	}

	virtual ~Exception() throw() {
		delete mMessage;
	}

	virtual const char* what() const throw() {
	    return mMessage;
	}

private:
	char* mMessage;
};

}

#endif /* EXCEPTION_H_ */
